package com.yingside.collection;

import java.util.*;

public class TestListArray {
    public static void main(String[] args) {
        //集合转数组
//        List<Integer> list = new ArrayList<>();
//        list.add(1);
//        list.add(2);
//        list.add(3);
//        list.add(4);

//        Object[] objects = list.toArray();
//        System.out.println("objects = " + Arrays.toString(objects));

//        Integer[] integers = list.toArray(new Integer[list.size()]);
//        System.out.println("integers = " + Arrays.toString(integers));

        Student s1 = new Student(1,"aa","11");
        Student s2 = new Student(2,"bb","22");
        Student s3 = new Student(3,"cc","33");
        Student s4 = new Student(4,"dd","144");
//
//        List<Student> list = new ArrayList<>();
//        list.add(s1);
//        list.add(s2);
//        list.add(s3);
//        list.add(s4);
//
//        Student[] students = list.toArray(new Student[list.size()]);
//        System.out.println("Arrays.toString(students) = " + Arrays.toString(students));


//        数组转集合
        Student [] stus = new Student[4];
        stus[0] = new Student(1,"aa","11");
        stus[1] = new Student(2,"bb","22");
        stus[2] = new Student(3,"cc","33");
        stus[3] = new Student(4,"dd","144");

        List<Student> studentList = Arrays.asList(new Student());
        Iterator<Student> iterator = studentList.iterator();

    }
}
